package com.chinacoal.microservice.api;

import java.util.List;

import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import com.baomidou.mybatisplus.plugins.Page;
import com.chinacoal.microservice.api.fallback.TaskExtAttrRegisterClientFallback;
import com.chinacoal.microservice.api.model.entity.UtaskAttrEntity;
import com.chinacoal.microservice.model.common.Entity.InsertValid;
import com.chinacoal.microservice.model.common.Entity.UpdateValid;
import com.chinacoal.microservice.model.syscenter.ComboxEntity;
import com.chinacoal.microservice.util.result.Result;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

/**
 * @Description: 待办类型的扩展属性管理接口
 * @author linp
 * @date 2019年11月29日 下午7:21:16
 * @version V1.0
 */
@Api(tags = {"待办类型的扩展属性管理接口"})
@FeignClient(name = "ccms-union-task", configuration = FeignAutoConfiguration.class, fallback = TaskExtAttrRegisterClientFallback.class)
public interface TaskExtAttrRegisterClient {

    @ApiOperation(value = "新增待办类型的扩展属性")
    @PostMapping("/uniontask/extattr/add")
    public Result<Object> addRegAttr(@Validated({InsertValid.class}) @RequestBody UtaskAttrEntity utaskAttrEntity);

    @ApiOperation(value = "修改待办类型的扩展属性")
    @PutMapping("/uniontask/extattr/update")
    public Result<Object> updateRegAttr(@Validated({UpdateValid.class}) @RequestBody UtaskAttrEntity utaskAttrEntity);

    @ApiOperation(value = "删除待办类型的扩展属性")
    @ApiImplicitParams({
    	@ApiImplicitParam(paramType="path", name = "attrId", value = "主键id", required = true, dataType = "String")
    })
    @DeleteMapping("/uniontask/extattr/delete/{attrId}")
    public Result<Object> deleteRegAttr(@PathVariable("attrId") String attrId);

    @ApiOperation(value = "查询待办类型的扩展属性列表")
    @ApiImplicitParams({
        @ApiImplicitParam(paramType="path", name = "page", value = "当前页码", required = true, dataType = "int"),
        @ApiImplicitParam(paramType="path", name = "pageSize", value = "每页记录数", required = true, dataType = "int"),
        @ApiImplicitParam(paramType="query", name = "expression", value = "模糊查询（按属性编码、属性名称）", required = false, dataType = "String")
    })
    @GetMapping("/uniontask/extattr/getList/{page}/{pageSize}")
    public Result<Page<UtaskAttrEntity>> getList(@PathVariable("page") Integer page,
										   @PathVariable("pageSize") Integer pageSize,
										   @RequestParam(value = "expression",required = false) String expression);

    @ApiOperation(value = "查询待办类型的扩展属性详情（按主键id）")
    @ApiImplicitParams({
    	@ApiImplicitParam(paramType="path", name = "attrId", value = "主键id", required = true, dataType = "String")
    })
    @GetMapping("/uniontask/extattr/getTaskAttr/{attrId}")
	public Result<UtaskAttrEntity> getTaskAttr(@PathVariable("attrId") String attrId);
    
    @ApiOperation(value = "获取待办类型的扩展属性下拉框")
    @GetMapping("/uniontask/extattr/getTaskAttrComboBox")
    public Result<List<ComboxEntity>> getTaskAttrComboBox();
}
